<template>
	<div>
		<div class="paySuceessTip" v-if="isPaysuceess">
			<span>支付成功</span>
		</div>
		<!-- 全部订单-收费订单详情 -->
		<div class="allorders_charge_details">
			<!-- 课程、商品订单 -->
			<div v-show="ordertype==1||ordertype==2">
				<div class="row">
					<span class="title">学员信息</span>
				</div>
				<el-row style="margin-top:0.1rem;">
					<el-col :span="4">
						<span class="label">姓名：</span>
						<span class="value">{{studentInfo.studentName}}</span>
					</el-col>
					<el-col :span="5">
						<span class="label">联系人：</span>
						<span class="value">{{studentInfo.parentName}}</span>
					</el-col>
					<el-col :span="5">
						<span class="label">联系电话：</span>
						<span class="value">{{studentInfo.phoneNumber}}</span>
					</el-col>
					<el-col :span="5">
						<span class="label">交易时间：</span>
						<span class="value">{{studentInfo.orderTime}}</span>
					</el-col>
					<el-col :span="5">
						<span class="label">操作时间：</span>
						<span class="value">{{studentInfo.createTime}}</span>
					</el-col>
				</el-row>
				<div class="row">
					<div class="txtbox">
						<span class="label">合同号：</span>
						<span class="value">{{studentInfo.orderNo}}</span>
					</div>
				</div>
				<div class="row" style="margin-top: 0.16rem;">
					<span class="title">收款详情</span>
				</div>
				<div class="row table">
					<div class="table" style="width:100%;">
						<template >
							<el-table
								:data="tableData"
								stripe
								style="width: 100%;font-size:0.16rem;"
								>
								<el-table-column
								align="center"
								width="50"
								label="">
									<template slot-scope="scope">
										<div class="orderTypeSymbol" :type="scope.row.p_ordertype" v-if="scope.row.p_ordertype==1">课</div>
										<div class="orderTypeSymbol" :type="scope.row.p_ordertype" v-else-if="scope.row.p_ordertype==2">商</div>
										<div class="orderTypeSymbol" :type="scope.row.p_ordertype" v-else-if="scope.row.p_ordertype==3">订</div>
										<div class="orderTypeSymbol" :type="scope.row.p_ordertype" v-else-if="scope.row.p_ordertype==4">餐</div>
									</template>
								</el-table-column>
								<el-table-column
								align="center"
								width="150"
								prop="p_orderName"
								label="课程/商品">
								</el-table-column>
								<el-table-column
								align="center"
								label="单价">
									<template slot-scope="scope">
										<span v-show="scope.row.p_unitPrice===0||(scope.row.p_unitPrice)">￥{{scope.row.p_unitPrice}}</span>
									</template>
								</el-table-column>
								<el-table-column
								align="center"
								prop="p_unit"
								label="单位">
								</el-table-column>
								<el-table-column
								align="center"
								prop="p_buyNumber"
								label="购买数量">
								</el-table-column>
								<el-table-column
								align="center"
								label="合计">
									<template slot-scope="scope">
										<span v-show="scope.row.p_totalMoney===0||(scope.row.p_totalMoney)">￥{{scope.row.p_totalMoney}}</span>
									</template>
								</el-table-column>
								<el-table-column
								align="center"
								label="优惠金额">
									<template slot-scope="scope">
										<span v-show="scope.row.p_discountMoney===0||(scope.row.p_discountMoney)">￥{{scope.row.p_discountMoney}}</span>
									</template>
								</el-table-column>
								<el-table-column
								align="center"
								prop="p_discountName"
								label="优惠名称">
								</el-table-column>
								<!-- <el-table-column
								align="center"
								label="订金扣减">
									<template slot-scope="scope">
										<span v-show="scope.row.p_depositDiscountMoney===0||(scope.row.p_depositDiscountMoney)">￥{{scope.row.p_depositDiscountMoney}}</span>
									</template>
								</el-table-column> -->
								<el-table-column
								align="center"
								label="应支付">
									<template slot-scope="scope">
										<span v-show="scope.row.p_shouldPayMoney===0||(scope.row.p_shouldPayMoney)">￥{{scope.row.p_shouldPayMoney}}</span>
									</template>
								</el-table-column>
								<el-table-column
								v-if="!isCancelOrder"
								align="center"
								prop="p_orderState"
								label="状态">
								</el-table-column>
							</el-table>
						</template>
					</div>
					<div class="statisticsBox" style="margin-top: 0.1rem;">
						<div class="item primary">
							<span class="label">总计：</span>
							<span class="value">￥{{tableStatistics.totalMoney}}</span>
						</div>
						<div class="item deposit" v-if="tableStatistics.earnestMoney>0">
							<span class="label">订金扣减：</span>
							<span class="value">￥{{tableStatistics.earnestMoney}}</span>
						</div>
						<div class="item actual">
							<span class="label">实际支付：</span>
							<span class="value">￥{{tableStatistics.realMoney}}</span>
						</div>
					</div>
				</div>
				<div class="row line" style="margin-top: 0.3rem;"></div>
				<!-- 其他信息 -->
				<div v-if="!selectPayMode">
					<div class="row" style="margin-top: 0.16rem;">
						<span class="otherinfo">其他信息</span>
					</div>
					<div class="row">
						<div class="txtbox alignCenterBox" style="width:100%;">
							<span class="label">订单号：</span>
							<span class="value">{{otherInfo.orderNo}}</span>
						</div>
					</div>
					<div class="row">
						<div class="txtbox alignCenterBox" style="width:100%;">
							<span class="label">第三方订单号：</span>
							<span class="value">{{otherInfo.otherOrderNo}}</span>
						</div>
					</div>
					<div v-if="!isCancelOrder" class="row">
						<div class="txtbox alignCenterBox" style="width:100%;">
							<span class="label">状态：</span>
							<span class="value">{{otherInfo.statu}}</span>
						</div>
					</div>
					<el-row v-else style="margin-top: 0.1rem;">
						<el-col :span="5">
							<span class="label" style="width: 1.25rem;text-align: right;display: inline-block;">状态：</span>
							<span class="value">{{otherInfo.statu}}</span>
						</el-col>
						<el-col :span="5">
							<span class="label">驳回操作：</span>
							<span class="value">{{otherInfo.auditorUserName}}</span>
						</el-col>
						<el-col :span="5">
							<span class="label">驳回时间：</span>
							<span class="value">{{otherInfo.auditorTime}}</span>
						</el-col>
					</el-row>
					<div v-if="isCancelOrder" class="row">
						<div class="txtbox alignCenterBox" style="width:100%;">
							<span class="label">原因：</span>
							<span class="value">{{otherInfo.auditorRemark}}</span>
						</div>
					</div>
					<div class="row">
						<div class="txtbox alignCenterBox" style="width:100%;">
							<span class="label">支付方式：</span>
							<span class="value">{{otherInfo.payMode}}</span>
						</div>
					</div>
					<div class="row">
						<div class="txtbox alignCenterBox" style="width:100%;">
							<span class="label">跟单人：</span>
							<span class="value">{{otherInfo.executeUserName}}</span>
						</div>
					</div>
					<div class="row">
						<div class="txtbox alignCenterBox" style="width:100%;">
							<span class="label">收款人：</span>
							<span class="value">{{otherInfo.createUserName}}</span>
						</div>
					</div>
					<div class="row">
						<div class="txtbox alignCenterBox" style="width:100%;">
							<span class="label">备注：</span>
							<span class="value">{{otherInfo.mark}}</span>
						</div>
					</div>
				</div>
				
			</div>
			<!-- 餐费订单 -->
			<div v-show="ordertype==4">
				<div class="row">
					<span class="title">学员信息</span>
				</div>
				<div class="row">
					<div class="txtbox">
						<span class="label">姓名：</span>
						<span class="value">{{studentInfo.studentName}}</span>
					</div>
					<div class="txtbox">
						<span class="label">联系人：</span>
						<span class="value">{{studentInfo.parentName}}</span>
					</div>
					<div class="txtbox">
						<span class="label">联系电话：</span>
						<span class="value">{{studentInfo.phoneNumber}}</span>
					</div>
					<div class="txtbox">
						<span class="label">操作时间：</span>
						<span class="value">{{studentInfo.createTime}}</span>
					</div>
				</div>
				<div class="row">
					<div class="txtbox">
						<span class="label">合同号：</span>
						<span class="value">{{studentInfo.orderNo}}</span>
					</div>
				</div>
				<div class="row" style="margin-top: 0.16rem;">
					<span class="title">收款详情</span>
				</div>
				<div class="row table">
					<div class="table" style="width:100%;">
						<template >
							<el-table
								:data="tableData"
								stripe
								style="width: 100%;font-size:0.16rem;"
								>
								<el-table-column
								align="center"
								width="50"
								label="">
									<template slot-scope="scope">
										<div class="orderTypeSymbol" :type="scope.row.p_ordertype" v-if="scope.row.p_ordertype==1">课</div>
										<div class="orderTypeSymbol" :type="scope.row.p_ordertype" v-else-if="scope.row.p_ordertype==2">商</div>
										<div class="orderTypeSymbol" :type="scope.row.p_ordertype" v-else-if="scope.row.p_ordertype==3">订</div>
										<div class="orderTypeSymbol" :type="scope.row.p_ordertype" v-else-if="scope.row.p_ordertype==4">餐</div>
									</template>
								</el-table-column>
								<el-table-column
								align="center"
								width="150"
								prop="p_orderName"
								label="课程/商品">
								</el-table-column>
								<el-table-column
								align="center"
								label="单价">
									<template slot-scope="scope">
										<span v-show="scope.row.p_unitPrice===0||(scope.row.p_unitPrice)">￥{{scope.row.p_unitPrice}}</span>
									</template>
								</el-table-column>
								<el-table-column
								align="center"
								prop="p_buyNumber"
								label="购买数量">
								</el-table-column>
								<el-table-column
								align="center"
								label="合计">
									<template slot-scope="scope">
										<span v-show="scope.row.p_totalMoney===0||(scope.row.p_totalMoney)">￥{{scope.row.p_totalMoney}}</span>
									</template>
								</el-table-column>
								<el-table-column
								align="center"
								:label="isRefundChargeLunch?'符合增补天数':'符合退费天数'">
									<template slot-scope="scope">
										<span>{{Math.abs(scope.row.p_allowRefundDays)}}</span>
										<br>
										<el-button v-if="scope.row.p_allowRefundDays!=0" type="text" style="font-size:0.16rem;"
											@click="showMealsAttendList(scope.row)">用餐记录</el-button>
									</template>
								</el-table-column>
								<el-table-column
								align="center"
								:label="isRefundChargeLunch?'应补交金额':'应退费金额'">
									<template slot-scope="scope">
										<span v-show="scope.row.p_shouldRefundMoney===0||(scope.row.p_shouldRefundMoney)">￥{{Math.abs(scope.row.p_shouldRefundMoney)}}</span>
									</template>
								</el-table-column>
								<el-table-column
								align="center"
								label="应支付">
									<template slot-scope="scope">
										<span v-show="scope.row.p_shouldPayMoney===0||(scope.row.p_shouldPayMoney)">￥{{scope.row.p_shouldPayMoney}}</span>
									</template>
								</el-table-column>
								<el-table-column
								v-if="!isCancelOrder"
								align="center"
								prop="p_orderState"
								label="状态">
								</el-table-column>
							</el-table>
						</template>
					</div>
					<div class="statisticsBox" style="margin-top: 0.1rem;">
						<div class="item primary">
							<span class="label">总计：</span>
							<span class="value">￥{{tableStatistics.totalMoney}}</span>
						</div>
						<div class="item actual">
							<span class="label">实际支付：</span>
							<span class="value">￥{{tableStatistics.realMoney}}</span>
						</div>
						<div class="item deposit" v-if="false">
							<span class="label">优惠：</span>
							<span class="value">￥0</span>
						</div>
					</div>
				</div>
				<div class="row line" style="margin-top: 0.3rem;"></div>
				<!-- 其他信息 -->
				<div v-if="!selectPayMode">
					<div class="row" style="margin-top: 0.16rem;">
						<span class="otherinfo">其他信息</span>
					</div>
					<div class="row">
						<div class="txtbox alignCenterBox" style="width:100%;">
							<span class="label">订单号：</span>
							<span class="value">{{otherInfo.orderNo}}</span>
						</div>
					</div>
					<div class="row">
						<div class="txtbox alignCenterBox" style="width:100%;">
							<span class="label">第三方订单号：</span>
							<span class="value">{{otherInfo.otherOrderNo}}</span>
						</div>
					</div>
					<div v-if="!isCancelOrder" class="row">
						<div class="txtbox alignCenterBox" style="width:100%;">
							<span class="label">状态：</span>
							<span class="value">{{otherInfo.statu}}</span>
						</div>
					</div>
					<el-row v-else style="margin-top: 0.1rem;">
						<el-col :span="5">
							<span class="label" style="width: 1.25rem;text-align: right;display: inline-block;">状态：</span>
							<span class="value">{{otherInfo.statu}}</span>
						</el-col>
						<el-col :span="5">
							<span class="label">驳回操作：</span>
							<span class="value">{{otherInfo.auditorUserName}}</span>
						</el-col>
						<el-col :span="5">
							<span class="label">驳回时间：</span>
							<span class="value">{{otherInfo.auditorTime}}</span>
						</el-col>
					</el-row>
					<div v-if="isCancelOrder" class="row">
						<div class="txtbox alignCenterBox" style="width:100%;">
							<span class="label">原因：</span>
							<span class="value">{{otherInfo.auditorRemark}}</span>
						</div>
					</div>
					<div class="row">
						<div class="txtbox alignCenterBox" style="width:100%;">
							<span class="label">支付方式：</span>
							<span class="value">{{otherInfo.payMode}}</span>
						</div>
					</div>
					<div class="row">
						<div class="txtbox alignCenterBox" style="width:100%;">
							<span class="label">跟单人：</span>
							<span class="value">{{otherInfo.executeUserName}}</span>
						</div>
					</div>
					<div class="row">
						<div class="txtbox alignCenterBox" style="width:100%;">
							<span class="label">收款人：</span>
							<span class="value">{{otherInfo.createUserName}}</span>
						</div>
					</div>
					<div class="row">
						<div class="txtbox alignCenterBox" style="width:100%;">
							<span class="label">备注：</span>
							<span class="value">{{otherInfo.mark}}</span>
						</div>
					</div>
				</div>
				
			</div>
			<!-- 转班订单 -->
			<div v-show="ordertype==5">
				<div class="row">
					<span class="title">学员信息</span>
				</div>
				<div class="row">
					<div class="txtbox">
						<span class="label">姓名：</span>
						<span class="value">{{studentInfo.studentName}}</span>
					</div>
					<div class="txtbox">
						<span class="label">联系人：</span>
						<span class="value">{{studentInfo.parentName}}</span>
					</div>
					<div class="txtbox">
						<span class="label">联系电话：</span>
						<span class="value">{{studentInfo.phoneNumber}}</span>
					</div>
					<div class="txtbox">
						<span class="label">操作时间：</span>
						<span class="value">{{studentInfo.createTime}}</span>
					</div>
				</div>
				<div class="row">
					<div class="txtbox">
						<span class="label">合同号：</span>
						<span class="value">{{studentInfo.orderNo}}</span>
					</div>
				</div>
				<div class="row" style="margin-top: 0.16rem;">
					<span class="title">收款详情</span>
				</div>
				<div class="row table">
					<div class="table" style="width:100%;">
						<template >
							<el-table
								:data="tableData"
								stripe
								style="width: 100%;font-size:0.16rem;"
								>
								<el-table-column
								align="center"
								width="50"
								label="">
									<template slot-scope="scope">
										<div class="orderTypeSymbol" :type="scope.row.p_ordertype" v-if="scope.row.p_ordertype==1">课</div>
										<div class="orderTypeSymbol" :type="scope.row.p_ordertype" v-else-if="scope.row.p_ordertype==2">商</div>
										<div class="orderTypeSymbol" :type="scope.row.p_ordertype" v-else-if="scope.row.p_ordertype==3">订</div>
										<div class="orderTypeSymbol" :type="scope.row.p_ordertype" v-else-if="scope.row.p_ordertype==4">餐</div>
									</template>
								</el-table-column>
								<el-table-column
								align="center"
								width="150"
								prop="p_orderName"
								label="课程/商品">
								</el-table-column>
								<el-table-column
								align="center"
								label="单价">
									<template slot-scope="scope">
										<span v-show="scope.row.p_unitPrice===0||(scope.row.p_unitPrice)">￥{{scope.row.p_unitPrice}}</span>
									</template>
								</el-table-column>
								<el-table-column
								align="center"
								prop="p_unit"
								label="单位">
								</el-table-column>
								<el-table-column
								align="center"
								prop="p_buyNumber"
								label="购买数量">
								</el-table-column>
								<el-table-column
								align="center"
								label="合计">
									<template slot-scope="scope">
										<span v-show="scope.row.p_totalMoney===0||(scope.row.p_totalMoney)">￥{{scope.row.p_totalMoney}}</span>
									</template>
								</el-table-column>
								<el-table-column
								align="center"
								label="原班剩余费用">
									<template slot-scope="scope">
										<span v-show="scope.row.p_preClassMoney===0||(scope.row.p_preClassMoney)">￥{{scope.row.p_preClassMoney}}</span>
										<br>
										<el-button type="text" style="font-size:0.16rem;"
											@click="showChangeDetials(scope.row)">转班详情</el-button>
									</template>
								</el-table-column>
								<el-table-column
								align="center"
								label="转班支付">
									<template slot-scope="scope">
										<span v-show="scope.row.p_changeClassMoney===0||(scope.row.p_changeClassMoney)">￥{{scope.row.p_changeClassMoney}}</span>
									</template>
								</el-table-column>
								<!-- <el-table-column
								align="center"
								label="优惠金额">
									<template slot-scope="scope">
										<span v-show="scope.row.p_discountMoney===0||(scope.row.p_discountMoney)">￥{{scope.row.p_discountMoney}}</span>
									</template>
								</el-table-column>
								<el-table-column
								align="center"
								prop="p_discountName"
								label="优惠名称">
								</el-table-column> -->
								<!-- <el-table-column
								align="center"
								label="订金扣减">
									<template slot-scope="scope">
										<span v-show="scope.row.p_depositDiscountMoney===0||(scope.row.p_depositDiscountMoney)"
										>￥{{scope.row.p_depositDiscountMoney}}</span>
									</template>
								</el-table-column> -->
								<el-table-column
								align="center"
								:label="changeClass_classlabel">
									<template slot-scope="scope">
										<span v-show="scope.row.p_shouldPayMoney===0||(scope.row.p_shouldPayMoney)"
										>￥{{scope.row.p_shouldPayMoney}}</span>
									</template>
								</el-table-column>
								<el-table-column
								v-if="!isCancelOrder"
								align="center"
								prop="p_orderState"
								label="状态">
								</el-table-column>
							</el-table>
						</template>
					</div>
					<div class="statisticsBox" v-if="changeClass_classlabel=='应支付'" style="margin-top: 0.1rem;">
						<div class="item primary">
							<span class="label">总计：</span>
							<span class="value">￥{{tableStatistics.totalMoney}}</span>
						</div>
						<div class="item deposit" v-if="tableStatistics.earnestMoney>0">
							<span class="label">订金扣减：</span>
							<span class="value">￥{{tableStatistics.earnestMoney}}</span>
						</div>
						<div class="item actual">
							<span class="label">实际支付：</span>
							<span class="value">￥{{tableStatistics.realMoney}}</span>
						</div>
					</div>
					<div class="statisticsBox" v-else style="margin-top: 0.1rem;">
						<div class="item primary">
							<span class="label">应退费：</span>
							<span class="value">￥{{tableData[0].p_shouldPayMoney}}</span>
						</div>
						<div class="item actual">
							<span class="label">实际退费：</span>
							<span class="value">￥{{tableStatistics.realMoney}}</span>
						</div>
					</div>
				</div>
				<div class="row line" style="margin-top: 0.3rem;"></div>
				<!-- 其他信息 -->
				<div v-if="!selectPayMode">
					<div class="row" style="margin-top: 0.16rem;">
						<span class="otherinfo">其他信息</span>
					</div>
					<div class="row">
						<div class="txtbox alignCenterBox">
							<span class="label" >订单号：</span>
							<span class="value">{{otherInfo.orderNo}}</span>
						</div>
					</div>
					<div class="row">
						<div class="txtbox alignCenterBox">
							<span class="label" >第三方订单号：</span>
							<span class="value">{{otherInfo.otherOrderNo}}</span>
						</div>
					</div>
					<div v-if="!isCancelOrder" class="row">
						<div class="txtbox alignCenterBox" style="width:100%;">
							<span class="label">状态：</span>
							<span class="value">{{otherInfo.statu}}</span>
						</div>
					</div>
					<el-row v-else style="margin-top: 0.1rem;">
						<el-col :span="5">
							<span class="label" style="width: 1.25rem;text-align: right;display: inline-block;">状态：</span>
							<span class="value">{{otherInfo.statu}}</span>
						</el-col>
						<el-col :span="5">
							<span class="label">驳回操作：</span>
							<span class="value">{{otherInfo.auditorUserName}}</span>
						</el-col>
						<el-col :span="5">
							<span class="label">驳回时间：</span>
							<span class="value">{{otherInfo.auditorTime}}</span>
						</el-col>
					</el-row>
					<div v-if="isCancelOrder" class="row">
						<div class="txtbox alignCenterBox" style="width:100%;">
							<span class="label">原因：</span>
							<span class="value">{{otherInfo.auditorRemark}}</span>
						</div>
					</div>
					<div class="row">
						<div class="txtbox alignCenterBox">
							<span class="label" >支付方式：</span>
							<span class="value">{{otherInfo.payMode}}</span>
						</div>
					</div>
					<div class="row">
						<div class="txtbox alignCenterBox">
							<span class="label" >跟单人：</span>
							<span class="value">{{otherInfo.executeUserName}}</span>
						</div>
					</div>
					<div class="row">
						<div class="txtbox alignCenterBox">
							<span class="label" >收款人：</span>
							<span class="value">{{otherInfo.createUserName}}</span>
						</div>
					</div>
					<div class="row">
						<div class="txtbox alignCenterBox">
							<span class="label" >备注：</span>
							<span class="value">{{otherInfo.mark}}</span>
						</div>
					</div>
				</div>
				
			</div>

			<!-- 支付方式重选 -->
			<div class="box-selectPayMode" v-if="selectPayMode">
				<div class="row" style="margin-top: 0.26rem;">
					<span class="title">选择支付方式</span>
				</div>
				<div class="row" style="margin-top: 0.2rem;">
					<el-radio-group v-model="radioPayvalue" style="font-size:0.16rem;padding-left: 0.1rem;">
						<el-radio v-for="(row,index) in payModeData"  :label="row.value" :key="index">{{row.name}}</el-radio>
					</el-radio-group>
				</div>
				<div class="row" style="margin-top: 0.26rem;">
					<span class="title">关联业务</span>
				</div>
				<!-- <div class="row">
					<span style="display: inline-block;width: 1rem;line-height: 0.4rem;padding-left: 0.1rem;">收据号：</span>
					<el-input v-model="receiptNo" style="width:3rem;font-size:0.16rem;" maxlength="50"></el-input>
				</div> -->
				<div class="row">
					<span style="display: inline-block;width: 1rem;line-height: 0.4rem;padding-left: 0.1rem;">备注：</span>
					<el-input v-model="remark" style="width:3rem;font-size:0.16rem;" maxlength="50"></el-input>
				</div>
				<div class="row" style="justify-content: center;margin-top: 0.2rem;">
					<el-button class="resetElement" type="primary" style="width:1.5rem;"
					 @click="cancel">取消</el-button>
					<el-button class="resetElement" type="primary" style="width:1.5rem;"
					 @click="checkPayOrders">确定支付</el-button>
				</div>
			</div>
		</div>
		
		<!--学员考勤-->
		<attendance ref="attendance_meals"></attendance>
		<!-- 转班详情 -->
		<el-dialog class="changeclassDetials" title="转班详情"
			style="background: rgba(0,0,0,0.5);"
			:visible.sync="changeClassDetialsVisible"
			:close-on-click-modal="false"
			:modal="false">
			<ordersChangeClassDetials ref="ordersChangeClassDetials"></ordersChangeClassDetials>
		</el-dialog>
	</div>
</template>

<script>
	let vm;
	import attendance from "./attendance"; //学员考勤
	import ordersChangeClassDetials from "./orders_changeClassDetials"; //转班详情
	import fNumber from "@/js/utils/floatnumber.js"
	export default{
		components:{attendance,ordersChangeClassDetials},
		data(){
			return {
				/**类型 */
				ordertype:1,
				selectPayMode:false,
				isPaysuceess:false,//是否为支付成功界面
				/**学员信息 */
				studentInfo:{
					studentName:'',
					parentName:'',
					phoneNumber:'',
					createTime:'',
					orderNo:'',
				},
				/**表格数据 */
				tableData:[],
				tableStatistics:{
					totalMoney:0,
					realMoney:0
				},
				/**其他信息 */
				otherInfo:{
					orderNo:'',
					otherOrderNo:'',
					statu:'',
					payMode:'',
					createUserName:'',
					executeUserName:'',
					mark:''
				},
				payModeData:[],
				radioPayvalue:null,
				receiptNo:'',
				remark:'',
				changeClassDetialsVisible:false,
				isCancelOrder:false,//是否是取消的订单

				//转班
				/**转班支付 */
				changeClass_curClassMoney:0,
				/**原班剩余 */
				changeClass_preClassMoney:0,
				/**应支付/应退费 */
				changeClass_classlabel:'应支付',
				changeClass_shouldPayRefund:0,

				//餐费
				isRefundChargeLunch:false,//符合退费天数是否为负数
			}
		},
		methods:{
			/**初始化 */
			updateByData(data){
				this.ordertype=data.ordertype;
				this.selectPayMode=data.selectPayMode;
				this.studentInfo=data.studentInfo;
				this.tableData=data.tableData;
				this.tableStatistics=data.tableStatistics;
				this.otherInfo=data.otherInfo;
				this.primaryIndex=data.primaryIndex;
				this.radioPayvalue=data.payMode;
				this.receiptNo='';
				this.remark=data.otherInfo.mark;
				this.isPaysuceess=data.isPaysuceess;
				this.isCancelOrder=data.isCancelOrder;
				//转班重新获取数据
				if(this.ordertype==5){
					this.getChangeClassInfo();
				}
				//餐费
				else if(this.ordertype==4){
					vm.isRefundChargeLunch=false;
					this.tableData.forEach(meal=>{
						if(meal.p_allowRefundDays<0)vm.isRefundChargeLunch=true;
					});
				}
			},
			/**确定支付 */
			checkPayOrders(){
				if(!this.radioPayvalue){
					this.$message({
						message: '请选择支付方式！',
						type: 'warning'
					});
					return;
				}
				//线上支付
				if(this.radioPayvalue==3||this.radioPayvalue==4){
					this.$emit('gotoPay',{
						index:this.primaryIndex,
						payMode:this.radioPayvalue,
					});
					vm.$emit('hideMe');
				}
				//线下支付
				else{
					api.orderManage_payOrder({
						orderSigupId:this.otherInfo.orderNo,
						payMode:this.radioPayvalue,
						receiptNo:this.receiptNo,
						realMoney:this.tableStatistics.realMoney,
						remark:this.remark,
						_wait:'',
					}).then(function(d){
						if(d.resultCode==2000){
							vm.$message({
								message: '支付成功！',
								type: 'success'
							});
							vm.$emit('success');
							vm.$emit('hideMe');
						}
						else{
							vm.$message({
								message: d.message||'操作失败！',
								type: 'warning'
							});
						}
					});
				}
				// this.$emit('hideMe');
			},
			/**取消 */
			cancel(){
				this.$emit('hideMe');
			},
			/**餐费-考勤列表 */
			showMealsAttendList(li){
				// this.$refs.attendance_meals.init(this.studentInfo.studentId,
				// this.studentInfo.studentName,2);

				// debugger
				let param={
					mealsType:li.mealsType,
					mealsId:li.mealsId, 
					studentId:this.studentInfo.studentId,
					studentName:this.studentInfo.studentName,
					startTime:li.startTimeSettlement,
					endTime:li.endTimeSettlement
				};
				vm.$refs.attendance_meals.init(param);
			},
			/**转班--获取转班信息 */
			getChangeClassInfo(){
				let row=this.tableData[0];
				let orderCourseId=row.p_orderSignupCourseId||row.p_orderRefundCourseId;
				api.getExchangeOrderCourseInfo({orderCourseId:orderCourseId}).then(function(d){
					if(d.resultCode==2000){
						// debugger
						let classInfo=d.info||{};
						classInfo.coursePackage=classInfo.coursePackage||{};
						//单价
						let unitPriceNumber=Math.ceil(
								(classInfo.coursePackage.totalMoney * 100) /
								(classInfo.coursePackage.courseHour||1)
							) / 100;
						if(classInfo.coursePackage.chargeMode == 3){
							unitPriceNumber=classInfo.coursePackage.totalMoney
								// Math.ceil(
								// 	(classInfo.coursePackage.totalMoney * 100) /
								// 	(classInfo.totalCourseHour||1)
								// ) / 100;
						}
						
						//课耗
						let useCourseMoney=fNumber.parseNumber(classInfo.courseUseHour*unitPriceNumber);
						if(useCourseMoney>classInfo.realMoney)useCourseMoney=classInfo.realMoney;
						//剩余费用
						let surplusMoney=fNumber.parseNumber(classInfo.realMoney-useCourseMoney);
						//剩余费用
						// let surplusMoney=fNumber.parseNumber((classInfo.courseBuyNum-classInfo.courseUseHour)*unitPriceNumber);

						vm.changeClass_preClassMoney=surplusMoney;
						// vm.changeClass_preClassMoney=surplusMoney>classInfo.coursePackage.totalMoney?
						// classInfo.coursePackage.totalMoney:surplusMoney;

						//实际支付/实际退费--交易关闭的用这个
						// if(vm.tableData[0].orderState=='交易关闭')
							vm.tableStatistics.realMoney=classInfo.realRefundMoney||vm.tableStatistics.realMoney;
						vm.getShouldPayRefundMoney();
					}
					else{
						vm.changeClass_preClassMoney=0;
					}
				});
				//新班信息
				api.getClassInfoByIdChange({ classId: row.p_classId }).then(function(d) {
					if (d.resultCode == 2000) {
						let classInfo = d.info;
						if (!classInfo.coursePackage) classInfo.coursePackage = {};
						//单价
						let unitPriceNumber=Math.ceil(
								(classInfo.coursePackage.totalMoney * 100) /
								(classInfo.coursePackage.courseHour||1)
							) / 100;
						if(classInfo.coursePackage.chargeMode == 3){
							unitPriceNumber=classInfo.coursePackage.totalMoney
								// Math.ceil(
								// 	(classInfo.coursePackage.totalMoney * 100) /
								// 	(classInfo.totalCourseHour||1)
								// ) / 100;
						}
						
						vm.changeClass_curClassMoney=fNumber.multiply(row.p_buyNumber,unitPriceNumber);
						// vm.changeClass_curClassMoney=vm.changeClass_curClassMoney>classInfo.coursePackage.totalMoney
						// ?classInfo.coursePackage.totalMoney:vm.changeClass_curClassMoney;
						vm.getShouldPayRefundMoney();
					} else {
						vm.changeClass_curClassMoney=0;
					}
				});
			},
			/**转班--应退费 */
			getShouldPayRefundMoney(){
				//原班剩余
				this.tableData[0].p_preClassMoney=vm.changeClass_preClassMoney;
				//转班支付
				this.tableData[0].p_changeClassMoney=vm.changeClass_curClassMoney;
				//应退费/应支付
				this.tableData[0].p_shouldPayMoney = fNumber.subtract(vm.changeClass_curClassMoney,vm.changeClass_preClassMoney);
				this.changeClass_classlabel='应支付';
				if(this.tableData[0].p_shouldPayMoney<0){
					this.changeClass_classlabel='应退费';
					this.tableData[0].p_shouldPayMoney=Math.abs(this.tableData[0].p_shouldPayMoney);
				}
				
			},
			/**转班--详情弹窗 */
			showChangeDetials(row){
				this.changeClassDetialsVisible=true;
				this.$nextTick(d=>{
					vm.$refs['ordersChangeClassDetials'].updateByData({
						time:this.studentInfo.createTime,
						money:vm.tableStatistics.realMoney,
						operater:this.otherInfo.createUserName,
						classId:row.p_classId,
						orderCourseId:row.p_orderSignupCourseId||row.p_orderRefundCourseId,
						buyNumber:row.p_buyNumber,
						moneyType:1,//1-收费；2-退费
					});
				});
			},


		},
		mounted(){
		},
		computed:{
			
		},
		watch:{

		},
		created : function() {
			vm=this;
			this.payModeData=tool.getDictNameByValue(-100,'pay_mode');
		}
	}
</script>

<style lang="scss">
	.paySuceessTip {
		/*outline: 1px solid red;*/
		height: 1.3rem;
		text-align: center;
		font-size: 0.24rem;
		color: #333333;
		letter-spacing: 0.02rem;
		padding-top: 0.75rem;
		border-bottom: 0.01rem solid #f3f6fc;
		background: url(../../../assets/img/clue_manage/enroll_success.png);
		background-size: 0.66rem 0.67rem;
		background-position: center top;
		background-repeat: no-repeat;
	}
	.allorders_charge_details{
		padding: 0 0.04rem 0.2rem 0.04rem;
		font-size: 0.16rem;
		// color: #333333;
		.row{
			width: 100%;
			display: flex;
    		margin-top: 0.1rem;
			.title{
				font-size: 0.18rem;
				color: #333333;
				font-weight: bold;
			}
			.otherinfo{
				font-size: 0.18rem;
				color: #333333;
				font-weight: bold;
			}
			.txtbox{
				min-width: 25%;
				.label{

				}
				.value{

				}
			}
			.alignCenterBox{
				.label{
					width: 1.25rem;
					text-align: right;
					display: inline-block;
				}
			}
			.table{
				.el-table__header-wrapper{
					.el-table__header thead{
						color: #666666 !important;
						font-size: 0.16rem !important;
					}
				}
				.el-table__body-wrapper{
					.el-table__row{
						.cell{
							white-space: pre-line !important;
							font-size: 0.16rem !important;
						}
					}
					.cloumn-type{
						.type{
							display: block;
							height: 0.2rem;
							line-height: 0.2rem;
							font-size: 0.12rem;
							background-color: #3885F8;
							color: white;
							border-radius: 0.05rem;
							width: 0.35rem;
							padding: 0 0.05rem;
							text-align: center;
						}
					}
				}
			}
			.statisticsBox{
				width: 100%;
				text-align: right;
				font-size: 0.18rem;
				.primary{
					// font-size: 0.16rem;
				}
				.actual{
					.value{
						font-size: 0.26rem;
    					color: #fc7301;
						font-weight: 600;
					}
				}
				.deposit{
					// font-size: 0.14rem;
				}
				.item{
					.label{
						display: inline-block;
						width: 0.9rem;
						text-align: right;
					}
					.value{
						display: inline-block;
						min-width: 1.5rem;
						text-align: left;
					}
				}
			}
		}
		.row.line{
			width: 100%;
			height: 1px;
			border-top: 0.005rem solid #6666667d;
		}
		.row.table{
			flex-wrap: wrap;
		}
		// 滚动条
		.el-table__body-wrapper::-webkit-scrollbar {
			width: 0.05rem;
		}
		.el-table__body-wrapper::-webkit-scrollbar-thumb {
			border-radius: 0.5rem;
			background: #BBBBBB;
		}
		.el-table__body-wrapper::-webkit-scrollbar-track {
			background: #F2F6FC;
		}

		.box-selectPayMode{
			.el-radio__label{
				font-size: 0.18rem !important;
			}
		}
	}
	// 滚动条
	// .allorders_charge_details::-webkit-scrollbar {
	// 	width: 0.05rem;
	// }
	// .allorders_charge_details::-webkit-scrollbar-thumb {
	// 	border-radius: 0.5rem;
	// 	background: #BBBBBB;
	// }
	// .allorders_charge_details::-webkit-scrollbar-track {
	// 	background: #F2F6FC;
	// }
</style>